home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / Mesa-2.2 / util / winpos.c < prev    next >
Encoding:
Text File  |  1996-08-26  |  849 b   |  41 lines

  1. /* winpos.c */
  2.  
  3.  
  4. /*
  5.  * Set the current raster position to a specific window
  6.  * coordinate.  Also see the GL_MESA_window_pos extension.
  7.  */
  8.  
  9.  
  10. void WindowPos( GLfloat x, GLfloat y, GLfloat z )
  11. {
  12.    GLfloat fx, fy;
  13.  
  14.    /* Push current matrix mode and viewport attributes */
  15.    glPushAttrib( GL_TRANSFORM_BIT | GL_VIEWPORT_BIT );
  16.  
  17.    /* Setup projection parameters */
  18.    glMatrixMode( GL_PROJECTION );
  19.    glPushMatrix();
  20.    glLoadIdentity();
  21.    glMatrixMode( GL_MODELVIEW );
  22.    glPushMatrix();
  23.    glLoadIdentity();
  24.  
  25.    glDepthRange( z, z );
  26.    glViewport( (int) x - 1, (int) y - 1, 2, 2 );
  27.  
  28.    /* set the raster (window) position */
  29.    fx = x - (int) x;
  30.    fy = y - (int) y;
  31.    glRasterPos3f( fx, fy, 0.0 );
  32.  
  33.    /* restore matrices, viewport and matrix mode */
  34.    glPopMatrix();
  35.    glMatrixMode( GL_PROJECTION );
  36.    glPopMatrix();
  37.  
  38.    glPopAttrib();
  39. }
  40.  
  41.